Skip to content

DRIVERS-3535 - Client Backpressure with baseBackoffMS#1953

Open
NoahStapp wants to merge 21 commits into
mongodb:masterfrom
NoahStapp:DRIVERS-3535
Open

DRIVERS-3535 - Client Backpressure with baseBackoffMS#1953
NoahStapp wants to merge 21 commits into
mongodb:masterfrom
NoahStapp:DRIVERS-3535

Conversation

@NoahStapp

Copy link
Copy Markdown
Contributor

Please complete the following before merging:

  • Is the relevant DRIVERS ticket in the PR title?
  • Update changelog.
  • Test changes in at least one language driver. Python.
  • Test these changes against all server versions and topologies (including standalone, replica set, and sharded
    clusters).

@NoahStapp NoahStapp requested a review from a team as a code owner June 16, 2026 18:04
@NoahStapp NoahStapp requested review from jyemin and tadjik1 June 16, 2026 18:04
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/client-backpressure/client-backpressure.md Outdated
NoahStapp and others added 2 commits June 18, 2026 09:31
Co-authored-by: Sergey Zelenov <sergey.zelenov@mongodb.com>
@NoahStapp NoahStapp requested a review from a team as a code owner June 18, 2026 13:34
@NoahStapp NoahStapp requested a review from mana2-bot June 18, 2026 13:34

@tadjik1 tadjik1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NoahStapp, everything looks good! I will keep an eye on retryAfterMS max value, once it's set I'll approve this PR.

Comment thread source/client-backpressure/tests/README.md Outdated
Comment thread source/mongodb-handshake/tests/README.md Outdated
Comment thread source/mongodb-handshake/tests/README.md
@NoahStapp

Copy link
Copy Markdown
Contributor Author

After further discussion with Server, I've simplified the backoff calculation formula to remove the custom jitter for retryAfterMS. Now retryAfterMS simply replaces BASE_BACKOFF in the existing formula.

@NoahStapp NoahStapp requested review from blink1073 and tadjik1 June 23, 2026 16:06
@blink1073

Copy link
Copy Markdown
Member

As a note, the two failing checks should be fixed by #1958

retry_after_ms = exc.retry_after_ms
if retry_after_ms:
retry_after = retry_after / 1000 # Convert from milliseconds to seconds
backoff = jitter * min(MAX_BACKOFF, retry_after * 2 ** (attempt - 1))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jitter is undefined in this if block, should it be hoisted to above it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good catch.

@NoahStapp NoahStapp requested a review from blink1073 June 24, 2026 16:10

@blink1073 blink1073 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@NoahStapp NoahStapp requested a review from blink1073 June 24, 2026 16:24
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/client-backpressure/client-backpressure.md Outdated
Comment thread source/mongodb-handshake/handshake.md
@NoahStapp NoahStapp requested a review from jyemin June 25, 2026 19:25
@NoahStapp

Copy link
Copy Markdown
Contributor Author

SERVER-130142 Will rename retryAfterMS to baseBackoffMS, holding off on merge until that change is complete.

@NoahStapp NoahStapp changed the title DRIVERS-3535 - Client Backpressure with retryAfterMS DRIVERS-3535 - Client Backpressure with baseBackoffMS Jul 8, 2026
@NoahStapp NoahStapp requested review from jyemin and tadjik1 July 8, 2026 19:23
@NoahStapp NoahStapp requested a review from a team as a code owner July 8, 2026 20:03
@NoahStapp NoahStapp requested a review from rozza July 8, 2026 20:03

@jyemin jyemin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on the retryAfterMS => baseBackoffMS change.

Deferring to other implementers for the test changes, as I haven't successfully implemented them.

papafe added a commit to papafe/mongo-csharp-driver that referenced this pull request Jul 13, 2026
Update the exponential-backoff formula from 2^(attempt-1) to 2^attempt
per the client-backpressure and transactions-convenient-api spec change
(mongodb/specifications#1953), and update the dependent backoff tests.
Also adds the baseBackoffMS overload integration test.
papafe added a commit to papafe/mongo-csharp-driver that referenced this pull request Jul 13, 2026
Update the exponential-backoff formula from 2^(attempt-1) to 2^attempt
per the client-backpressure and transactions-convenient-api spec change
(mongodb/specifications#1953), and update the dependent backoff tests.
Also adds the baseBackoffMS overload integration test.

@papafe papafe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sanych-sun sanych-sun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transactions-convenient-api changes is OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants